package cn.edu.scau.cmi.liangzaoqing.client;

import java.lang.reflect.InvocationTargetException;

import cn.edu.scau.cmi.liangzaoqing.spring.bean.Student;

public class ReflectExampleClient {
		// 利用反射创建对象，必须先创建类，再次
		public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception, InvocationTargetException, NoSuchMethodException, SecurityException {
			 
			Class<?> studentClass = Class.forName("cn.edu.scau.cmi.liangzaoqing.spring.domain.Student");
			Student student=(Student) studentClass.getDeclaredConstructor().newInstance();//.newInstance()
			
			
//			 (Student) studentClass.newInstance();
			 student.setName("梁早清");
			 System.out.println(student.getName());
			
		}

}
